{block name=head}
<style type="text/css">
</style>
{/block} {block name=body}
<div id="main">
    <div class="container">
        <div class="row hidden-xs">
            <div class="col-sm-12">
                {include file='breadcrumbs.tpl'}
            </div>
        </div>
        <div class="row">
            <div class="col-sm-8 col-sm-offset-2">
                {if $listing_content3} {if $listing_content5}
                <a target="_blank" href="{$listing_content5}"><img src="{$listing_content3}" class="img-responsive ad-banner" alt="{$listing_title} ad-banner" /></a>
                {else}
                <img src="{$listing_content3}" class="img-responsive ad-banner" alt="{$listing_title} ad-banner" /> {/if} {/if}
            </div>
        </div>
        <div class="row">
            <div id="maintext" class="col-sm-12">
                <h1 class="title">课程报名{$listing_name}</h1> {$listing_content1}
            </div>
        </div>
    </div>
</div>
<div class="container" id="result">
    {if $classes}
    <div class="row">
        <div class="col-sm-12 text-center bluebox">
            当前可以报名的课程显示在下方表格中。
            <br> 请点击对应课程了解详细信息。
        </div>
        <div class="col-sm-12 text-center">
            {if $location }
            <b>{$location}</b> 的场馆及课程 {/if}
        </div>
    </div>
    <div class="row">
        <!-- Nav tabs -->
        <ul class="nav nav-tabs termtoggle hidden-xs" role="tablist" id="tabs1">
            {foreach from=$terms key=key item=val name=tarr}
            {if $smarty.foreach.tarr.index lt 2}
                 <li class="{if $smarty.foreach.tarr.first}active{/if}">
                    {assign var=term_shortname value="|"|explode:$val.term_name}
                    <a href="#term{$smarty.foreach.tarr.index}" role="tab" data-toggle="tab">{$term_shortname.0}</a>
                </li>
            {else if $smarty.foreach.tarr.index eq 2}
                <li role="presentation" class="dropdown">
                <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">更多学期<span class="caret"></span>
                </a>
                <ul class="dropdown-menu">
                    <li class="">
                        {assign var=term_shortname value="|"|explode:$val.term_name}
                        <a href="#term{$smarty.foreach.tarr.index}" role="tab" data-toggle="tab">{$term_shortname.0}</a>
                    </li>
            {else}
                    <li class="">
                        {assign var=term_shortname value="|"|explode:$val.term_name}
                        <a href="#term{$smarty.foreach.tarr.index}" role="tab" data-toggle="tab">{$term_shortname.0}</a>
                    </li>
            {/if}
            {if $smarty.foreach.tarr.last && $smarty.foreach.tarr gt 1}
                </ul>
            </li>
            {/if}
            {/foreach}
        </ul>
        <ul class="nav nav-tabs nav-stacked termtoggle visible-xs" role="tablist" id="tabs2">
            {foreach from=$terms key=key item=val name=tarr}
                 <li class="{if $smarty.foreach.tarr.first}active{/if}">
                    {assign var=term_shortname value="|"|explode:$val.term_name}
                    <a href="#term{$smarty.foreach.tarr.index}" role="tab" data-toggle="tab">{$term_shortname.0}</a>
                </li>
            {/foreach}
        </ul>
        <div class="col-sm-2 pull-right small text-right hidden-xs"><a href="/our-program/term-dates">查看学期安排</a></div>
        <div class="tab-content">
            {foreach from=$terms key=key item=val name=tarr}
            <div class="term tab-pane {if $smarty.foreach.tarr.first}active{/if}" id="term{$smarty.foreach.tarr.index}">
                {if !$classes[$val.term_object_id]}
                <div class="visible-xs text-center"><b>该学期没有找到课程。</b></div>
                <table id="resulttable" class="hidden-xs">
                    <tr><td style="text-align:center!important;"><b>该学期没有找到课程。</b></td></tr>
                </table>
                {else}
                <form id="search-classes-form" method="get" action="/enrol/search">
                    <input type="hidden" name="state" value={$search.state}>
                    <input type="hidden" name="suburb" value={$search.suburb}>
                    <input type="hidden" name="country" value={$search.country}>
                    <div class="col-sm-12">
                        <div class=" form-group">
                            <span class="form-group ts">
                                <select name="months">
                                    <option valuue=0>请选择</option>
                                    <option value=36 {if $search.months eq 36}selected="selected"{/if}>Ready Group</option>
                                    <option value=48 {if $search.months eq 48}selected="selected"{/if}>Steady Group</option>
                                    <option value=72 {if $search.months eq 72}selected="selected"{/if}>Go Group</option>
                                </select>
                            </span>
                            <span class="form-group ts">
                                <select name="class">
                                    <option valuue=0>请选择</option>
                                    <option value=1 {if $search.class eq 1}selected="selected"{/if}>Class 1</option>
                                    <option value=2 {if $search.class eq 2}selected="selected"{/if}>Class 2</option>
                                    <option value=3 {if $search.class eq 3}selected="selected"{/if}>Class 3</option>
                                    <option value=4 {if $search.class eq 4}selected="selected"{/if}>Class 4</option>
                                </select>
                            </span>
                            <button class="enrol-search" type="submit">筛选</button>
                        </div>
                    </div>
                </form>
                <div class="visible-xs">
                    {foreach $classes as $termOID => $termArr}
                    {if $termOID eq $val.term_object_id}
                    <div class="row" id="monday">
                        <div class="col-sm-12">星期一</div>
                        {foreach $termArr as $locOID => $locArr}
                        {if $locArr.Monday}
                        <div class="row">
                            <div class="col-xs-6">
                                    {$locArr.location_name}
                                    <div class="small">{$locArr.location_address}</div>
                            </div>
                            <div class="col-xs-6">
                            {foreach from=$locArr.Monday key=classk item=item name=classArr}
                                {if !$smarty.foreach.classArr.first}
                                <br>{/if}
                                <a {if $item.availability.available lt 5 && $item.availability.available gt 0}class="almost" {elseif $item.availability.available lt 1}class="full" {/if} href="/enrol/classterm/{$item.term_url}/{$item.class_url}">
                                {if $item.agegroup_max lt 48}<div class="class-r">Ready Group</div>{else if $item.agegroup_max lt 72}<div class="class-s">Steady Group</div>{else}<div class="class-g">Go Group</div>{/if}
                                <div class="class-b">Class {$item.class_num}</div>
                                {$item.class_start_time|date_format:"%H:%M"|lower}-{$item.class_end_time|date_format:"%H:%M"|lower}<br><div class="agegroup">{$item.agegroup_shortname}</div>
                                {if $item.availability.available lt 5  && $item.availability.available gt 0}<small>即将报满</small>{elseif $item.availability.available lt 1}<small>课程报满</small>{/if}
                                </a>
                            {/foreach}
                            </div>
                        </div>
                        {/if}
                        {/foreach}
                    </div>
                    <div class="row" id="tuesday">
                        <div class="col-sm-12">星期二</div> 
                        {foreach $termArr as $locOID => $locArr}
                        {if $locArr.Tuesday}
                        <div class="row">
                            <div class="col-xs-6">
                                    {$locArr.location_name}
                                    <div class="small">{$locArr.location_address}</div>
                            </div>
                            <div class="col-xs-6">
                            {foreach from=$locArr.Tuesday key=classk item=item name=classArr}
                                {if !$smarty.foreach.classArr.first}
                                <br>{/if}
                                <a {if $item.availability.available lt 5 && $item.availability.available gt 0}class="almost" {elseif $item.availability.available lt 1}class="full" {/if} href="/enrol/classterm/{$item.term_url}/{$item.class_url}">
                                {if $item.agegroup_max lt 48}<div class="class-r">Ready Group</div>{else if $item.agegroup_max lt 72}<div class="class-s">Steady Group</div>{else}<div class="class-g">Go Group</div>{/if}
                                <div class="class-b">Class {$item.class_num}</div>
                                {$item.class_start_time|date_format:"%H:%M"|lower}-{$item.class_end_time|date_format:"%H:%M"|lower}<br><div class="agegroup">{$item.agegroup_shortname}</div>
                                {if $item.availability.available lt 5  && $item.availability.available gt 0}<small>即将报满</small>{elseif $item.availability.available lt 1}<small>课程报满</small>{/if}
                                </a>
                            {/foreach}
                            </div>
                        </div>
                        {/if}
                        {/foreach}
                    </div>
                    <div class="row" id="wednesday">
                        <div class="col-sm-12">星期三</div>
                        {foreach $termArr as $locOID => $locArr}
                        {if $locArr.Wednesday}
                        <div class="row">
                            <div class="col-xs-6">
                                    {$locArr.location_name}
                                    <div class="small">{$locArr.location_address}</div>
                            </div>
                            <div class="col-xs-6">
                            {foreach from=$locArr.Wednesday key=classk item=item name=classArr}
                                {if !$smarty.foreach.classArr.first}
                                <br>{/if}
                                <a {if $item.availability.available lt 5 && $item.availability.available gt 0}class="almost" {elseif $item.availability.available lt 1}class="full" {/if} href="/enrol/classterm/{$item.term_url}/{$item.class_url}">
                                {if $item.agegroup_max lt 48}<div class="class-r">Ready Group</div>{else if $item.agegroup_max lt 72}<div class="class-s">Steady Group</div>{else}<div class="class-g">Go Group</div>{/if}
                                <div class="class-b">Class {$item.class_num}</div>
                                {$item.class_start_time|date_format:"%H:%M"|lower}-{$item.class_end_time|date_format:"%H:%M"|lower}<br><div class="agegroup">{$item.agegroup_shortname}</div>
                                {if $item.availability.available lt 5  && $item.availability.available gt 0}<small>即将报满</small>{elseif $item.availability.available lt 1}<small>课程报满</small>{/if}
                                </a>
                            {/foreach}
                            </div>
                        </div>
                        {/if}
                        {/foreach}
                    </div>
                    <div class="row" id="thursday">
                        <div class="col-sm-12">星期四</div>
                        {foreach $termArr as $locOID => $locArr}
                        {if $locArr.Thursday}
                        <div class="row">
                            <div class="col-xs-6">
                                    {$locArr.location_name}
                                    <div class="small">{$locArr.location_address}</div>
                            </div>
                            <div class="col-xs-6">
                            {foreach from=$locArr.Thursday key=classk item=item name=classArr}
                                {if !$smarty.foreach.classArr.first}
                                <br>{/if}
                                <a {if $item.availability.available lt 5 && $item.availability.available gt 0}class="almost" {elseif $item.availability.available lt 1}class="full" {/if} href="/enrol/classterm/{$item.term_url}/{$item.class_url}">
                                {if $item.agegroup_max lt 48}<div class="class-r">Ready Group</div>{else if $item.agegroup_max lt 72}<div class="class-s">Steady Group</div>{else}<div class="class-g">Go Group</div>{/if}
                                <div class="class-b">Class {$item.class_num}</div>
                                {$item.class_start_time|date_format:"%H:%M"|lower}-{$item.class_end_time|date_format:"%H:%M"|lower}<br><div class="agegroup">{$item.agegroup_shortname}</div>
                                {if $item.availability.available lt 5  && $item.availability.available gt 0}<small>即将报满</small>{elseif $item.availability.available lt 1}<small>课程报满</small>{/if}
                                </a>
                            {/foreach}
                            </div>
                        </div>
                        {/if}
                        {/foreach}
                    </div>
                    <div class="row" id="friday">
                        <div class="col-sm-12">星期五</div>
                        {foreach $termArr as $locOID => $locArr}
                        {if $locArr.Friday}
                        <div class="row">
                            <div class="col-xs-6">
                                    {$locArr.location_name}
                                    <div class="small">{$locArr.location_address}</div>
                            </div>
                            <div class="col-xs-6">
                            {foreach from=$locArr.Friday key=classk item=item name=classArr}
                                {if !$smarty.foreach.classArr.first}
                                <br>{/if}
                                <a {if $item.availability.available lt 5 && $item.availability.available gt 0}class="almost" {elseif $item.availability.available lt 1}class="full" {/if} href="/enrol/classterm/{$item.term_url}/{$item.class_url}">
                                {if $item.agegroup_max lt 48}<div class="class-r">Ready Group</div>{else if $item.agegroup_max lt 72}<div class="class-s">Steady Group</div>{else}<div class="class-g">Go Group</div>{/if}
                                <div class="class-b">Class {$item.class_num}</div>
                                {$item.class_start_time|date_format:"%H:%M"|lower}-{$item.class_end_time|date_format:"%H:%M"|lower}<br><div class="agegroup">{$item.agegroup_shortname}</div>
                                {if $item.availability.available lt 5  && $item.availability.available gt 0}<small>即将报满</small>{elseif $item.availability.available lt 1}<small>课程报满</small>{/if}
                                </a>
                            {/foreach}
                            </div>
                        </div>
                        {/if}
                        {/foreach}
                    </div>
                    <div class="row" id="saturday">
                        <div class="col-sm-12">星期六</div>
                        {foreach $termArr as $locOID => $locArr}
                        {if $locArr.Saturday}
                        <div class="row">
                            <div class="col-xs-6">
                                    {$locArr.location_name}
                                    <div class="small">{$locArr.location_address}</div>
                            </div>
                            <div class="col-xs-6">
                            {foreach from=$locArr.Saturday key=classk item=item name=classArr}
                                {if !$smarty.foreach.classArr.first}
                                <br>{/if}
                                <a {if $item.availability.available lt 5 && $item.availability.available gt 0}class="almost" {elseif $item.availability.available lt 1}class="full" {/if} href="/enrol/classterm/{$item.term_url}/{$item.class_url}">
                                {if $item.agegroup_max lt 48}<div class="class-r">Ready Group</div>{else if $item.agegroup_max lt 72}<div class="class-s">Steady Group</div>{else}<div class="class-g">Go Group</div>{/if}
                                <div class="class-b">Class {$item.class_num}</div>
                                {$item.class_start_time|date_format:"%H:%M"|lower}-{$item.class_end_time|date_format:"%H:%M"|lower}<br><div class="agegroup">{$item.agegroup_shortname}</div>
                                {if $item.availability.available lt 5  && $item.availability.available gt 0}<small>即将报满</small>{elseif $item.availability.available lt 1}<small>课程报满</small>{/if}
                                </a>
                            {/foreach}
                            </div>
                        </div>
                        {/if}
                        {/foreach}
                    </div>
                    <div class="row" id="sunday">
                        <div class="col-sm-12">星期日</div>
                        {foreach $termArr as $locOID => $locArr}
                        {if $locArr.Sunday}
                        <div class="row">
                            <div class="col-xs-6">
                                    {$locArr.location_name}
                                    <div class="small">{$locArr.location_address}</div>
                            </div>
                            <div class="col-xs-6">
                            {foreach from=$locArr.Sunday key=classk item=item name=classArr}
                                {if !$smarty.foreach.classArr.first}
                                <br>{/if}
                                <a {if $item.availability.available lt 5 && $item.availability.available gt 0}class="almost" {elseif $item.availability.available lt 1}class="full" {/if} href="/enrol/classterm/{$item.term_url}/{$item.class_url}">
                                {if $item.agegroup_max lt 48}<div class="class-r">Ready Group</div>{else if $item.agegroup_max lt 72}<div class="class-s">Steady Group</div>{else}<div class="class-g">Go Group</div>{/if}
                                <div class="class-b">Class {$item.class_num}</div>
                                {$item.class_start_time|date_format:"%H:%M"|lower}-{$item.class_end_time|date_format:"%H:%M"|lower}<br><div class="agegroup">{$item.agegroup_shortname}</div>
                                {if $item.availability.available lt 5  && $item.availability.available gt 0}<small>即将报满</small>{elseif $item.availability.available lt 1}<small>课程报满</small>{/if}
                                </a>
                            {/foreach}
                            </div>
                        </div>
                        {/if}
                        {/foreach}
                    </div>
                    {/if}
                    {/foreach}
                </div>
                <table id="resulttable" class="hidden-xs">
                    <thead>
                        <tr>
                            <th></th>
                            <th>周一</th>
                            <th>周二</th>
                            <th>周三</th>
                            <th>周四</th>
                            <th>周五</th>
                            <th>周六</th>
                            <th>周日</th>
                        </tr>
                    </thead>
                    <tbody>
                        {if $hasLocation eq 1}
                        <tr>
                            <td style="text-align:center!important;"><b>本学期已经结束。</b></td>
                        </tr>
                        {/if}
                        {foreach $classes as $termOID => $termArr}
                        {if $termOID eq $val.term_object_id}
                        {foreach $termArr as $locOID => $locArr}
                        <tr>
                            <td>
                                <div>
                                    {$locArr.location_name}
                                    <div class="small">{$locArr.location_address}</div>
                                </div>
                            </td>
                            <td>
                                <!-- Monday -->
                                {if $locArr.Monday} {foreach from=$locArr.Monday key=classk item=item name=classArr} {if !$smarty.foreach.classArr.first}
                                <br>{/if}
                                <a {if $item.availability.available lt 5 && $item.availability.available gt 0}class="almost" {elseif $item.availability.available lt 1}class="full" {/if} href="/enrol/classterm/{$item.term_url}/{$item.class_url}">
                                {if $item.agegroup_max lt 48}<div class="class-r">Ready Group</div>{else if $item.agegroup_max lt 72}<div class="class-s">Steady Group</div>{else}<div class="class-g">Go Group</div>{/if}
                                <div class="class-b">Class {$item.class_num}</div>
                                {$item.class_start_time|date_format:"%H:%M"|lower}-{$item.class_end_time|date_format:"%H:%M"|lower}<br><div class="agegroup">{$item.agegroup_shortname}</div>
                                {if $item.availability.available lt 5  && $item.availability.available gt 0}<small>即将报满</small>{elseif $item.availability.available lt 1}<small>课程报满</small>{/if}
                                </a> {/foreach} {else} - {/if}
                            </td>
                            <td>
                                <!-- Tuesday -->
                                {if $locArr.Tuesday} {foreach from=$locArr.Tuesday key=classk item=item name=classArr} {if !$smarty.foreach.classArr.first}
                                <br>{/if}
                                <a {if $item.availability.available lt 5 && $item.availability.available gt 0}class="almost" {elseif $item.availability.available lt 1}class="full" {/if} href="/enrol/classterm/{$item.term_url}/{$item.class_url}">
                                {if $item.agegroup_max lt 48}<div class="class-r">Ready Group</div>{else if $item.agegroup_max lt 72}<div class="class-s">Steady Group</div>{else}<div class="class-g">Go Group</div>{/if}
                                <div class="class-b">Class {$item.class_num}</div>
                                {$item.class_start_time|date_format:"%H:%M"|lower}-{$item.class_end_time|date_format:"%H:%M"|lower}<div class="agegroup">{$item.agegroup_shortname}</div>
                                {if $item.availability.available lt 5  && $item.availability.available gt 0}<small>即将报满</small>{elseif $item.availability.available lt 1}<small>课程报满</small>{/if}
                                </a> {/foreach} {else} - {/if}
                            </td>
                            <td>
                                <!-- Wednesday -->
                                {if $locArr.Wednesday} {foreach from=$locArr.Wednesday key=classk item=item name=classArr} {if !$smarty.foreach.classArr.first}
                                <br>{/if}
                                <a {if $item.availability.available lt 5 && $item.availability.available gt 0}class="almost" {elseif $item.availability.available lt 1}class="full" {/if} href="/enrol/classterm/{$item.term_url}/{$item.class_url}">
                                {if $item.agegroup_max lt 48}<div class="class-r">Ready Group</div>{else if $item.agegroup_max lt 72}<div class="class-s">Steady Group</div>{else}<div class="class-g">Go Group</div>{/if}
                                <div class="class-b">Class {$item.class_num}</div>
                                {$item.class_start_time|date_format:"%H:%M"|lower}-{$item.class_end_time|date_format:"%H:%M"|lower}<br><div class="agegroup">{$item.agegroup_shortname}</div>
                                {if $item.availability.available lt 5  && $item.availability.available gt 0}<small>即将报满</small>{elseif $item.availability.available lt 1}<small>课程报满</small>{/if}
                                </a> {/foreach} {else} - {/if}
                            </td>
                            <td>
                                <!-- Thursday -->
                                {if $locArr.Thursday} {foreach from=$locArr.Thursday key=classk item=item name=classArr} {if !$smarty.foreach.classArr.first}
                                <br>{/if}
                                <a {if $item.availability.available lt 5 && $item.availability.available gt 0}class="almost" {elseif $item.availability.available lt 1}class="full" {/if} href="/enrol/classterm/{$item.term_url}/{$item.class_url}">
                                {if $item.agegroup_max lt 48}<div class="class-r">Ready Group</div>{else if $item.agegroup_max lt 72}<div class="class-s">Steady Group</div>{else}<div class="class-g">Go Group</div>{/if}
                                <div class="class-b">Class {$item.class_num}</div>
                                {$item.class_start_time|date_format:"%H:%M"|lower}-{$item.class_end_time|date_format:"%H:%M"|lower}<br><div class="agegroup">{$item.agegroup_shortname}</div>
                                {if $item.availability.available lt 5  && $item.availability.available gt 0}<small>即将报满</small>{elseif $item.availability.available lt 1}<small>课程报满</small>{/if}
                                </a> {/foreach} {else} - {/if}
                            </td>
                            <td>
                                <!-- Friday -->
                                {if $locArr.Friday} {foreach from=$locArr.Friday key=classk item=item name=classArr} {if !$smarty.foreach.classArr.first}
                                <br>{/if}
                                <a {if $item.availability.available lt 5 && $item.availability.available gt 0}class="almost" {elseif $item.availability.available lt 1}class="full" {/if} href="/enrol/classterm/{$item.term_url}/{$item.class_url}" data-available="{$item.availability.available}" data-taken="{$item.availability.taken}">
                                {if $item.agegroup_max lt 48}<div class="class-r">Ready Group</div>{else if $item.agegroup_max lt 72}<div class="class-s">Steady Group</div>{else}<div class="class-g">Go Group</div>{/if}
                                <div class="class-b">Class {$item.class_num}</div>
                                {$item.class_start_time|date_format:"%H:%M"|lower}-{$item.class_end_time|date_format:"%H:%M"|lower}<br><div class="agegroup">{$item.agegroup_shortname}</div>
                                {if $item.availability.available lt 5  && $item.availability.available gt 0}<small>即将报满</small>{elseif $item.availability.available lt 1}<small>课程报满</small>{/if}
                                </a> {/foreach} {else} - {/if}
                            </td>
                            <td>
                                <!-- Saturday -->
                                {if $locArr.Saturday} {foreach from=$locArr.Saturday key=classk item=item name=classArr} {if !$smarty.foreach.classArr.first}
                                <br>{/if}
                                <a {if $item.availability.available lt 5 && $item.availability.available gt 0}class="almost" {elseif $item.availability.available lt 1}class="full" {/if} href="/enrol/classterm/{$item.term_url}/{$item.class_url}">
                                {if $item.agegroup_max lt 48}<div class="class-r">Ready Group</div>{else if $item.agegroup_max lt 72}<div class="class-s">Steady Group</div>{else}<div class="class-g">Go Group</div>{/if}
                                <div class="class-b">Class {$item.class_num}</div>
                                {$item.class_start_time|date_format:"%H:%M"|lower}-{$item.class_end_time|date_format:"%H:%M"|lower}<br><div class="agegroup">{$item.agegroup_shortname}</div>
                                {if $item.availability.available lt 5  && $item.availability.available gt 0}<span>Almost full</span>{elseif $item.availability.available lt 1}<small>课程报满</small>{/if}
                                </a> {/foreach} {else} - {/if}
                            </td>
                            <td>
                                <!--Sunday -->
                                {if $locArr.Sunday} {foreach from=$locArr.Sunday key=classk item=item name=classArr} {if !$smarty.foreach.classArr.first}
                                <br>{/if}
                                <a {if $item.availability.available lt 5 && $item.availability.available gt 0}class="almost" {elseif $item.availability.available lt 1}class="full" {/if} href="/enrol/classterm/{$item.term_url}/{$item.class_url}">
                                {if $item.agegroup_max lt 48}<div class="class-r">Ready Group</div>{else if $item.agegroup_max lt 72}<div class="class-s">Steady Group</div>{else}<div class="class-g">Go Group</div>{/if}
                                <div class="class-b">Class {$item.class_num}</div>
                                {$item.class_start_time|date_format:"%H:%M"|lower}-{$item.class_end_time|date_format:"%H:%M"|lower}<br><div class="agegroup">{$item.agegroup_shortname}</div>
                                {if $item.availability.available lt 5  && $item.availability.available gt 0}<span>Almost full</span>{elseif $item.availability.available lt 1}<small>课程报满</small>{/if}
                                </a> {/foreach} {else} - {/if}
                            </td>
                        </tr>
                        {/foreach} {/if} {/foreach}
                    </tbody>
                </table>
                {/if}
            </div>
            {/foreach}
        </div>
    </div>
    {else}
    <div class="row">
        <div class="col-sm-12 text-center text-danger">
            <h3>没有{if $location}在<b> {$location} </b>{/if}找到课程</h3>
        </div>
    </div>
    {/if}
</div>
<div id="enroltrialhead">
    <div class="container">
        <div class="row">
            <div class="col-sm-12 text-center">
                查询其它地区课程
            </div>
        </div>
    </div>
</div>
<div id="enroltrialmain">
    <div class="container">
        <div class="row">
            <div class="col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
                <div class="row">
                    <!-- <div id="floatingCirclesG">
                        <div class="f_circleG" id="frotateG_01">
                        </div>
                        <div class="f_circleG" id="frotateG_02">
                        </div>
                        <div class="f_circleG" id="frotateG_03">
                        </div>
                        <div class="f_circleG" id="frotateG_04">
                        </div>
                        <div class="f_circleG" id="frotateG_05">
                        </div>
                        <div class="f_circleG" id="frotateG_06">
                        </div>
                        <div class="f_circleG" id="frotateG_07">
                        </div>
                        <div class="f_circleG" id="frotateG_08">
                        </div>
                    </div> -->
                    <form id="search-classes-form" method="get" action="/enrol/search">
                        <!-- <div class="col-sm-6">
                        <label>Child's D.O.B.:</label>
                        <div>
                        <span class="form-group ts">
                            <select id="dobday" name="day" class="form-control">
                                <option value="">Day</option>
                                {for $day=1 to 31}
                                    <option value="{$day}" {if $search.day eq $day}selected="selected"{/if}>{$day}</option>
                                {/for}
                            </select>
                        </span>
                        <span class="form-group to" id="monthout">
                            <select id="dobmonth" name="month" class="form-control">
                                    <option value="">Month</option>
                                    <option value="1" {if $search.month eq 1}selected="selected"{/if}>January</option>
                                    <option value="2" {if $search.month eq 2}selected="selected"{/if}>February</option>
                                    <option value="3" {if $search.month eq 3}selected="selected"{/if}>March</option>
                                    <option value="4" {if $search.month eq 4}selected="selected"{/if}>April</option>
                                    <option value="5" {if $search.month eq 5}selected="selected"{/if}>May</option>
                                    <option value="6" {if $search.month eq 6}selected="selected"{/if}>June</option>
                                    <option value="7" {if $search.month eq 7}selected="selected"{/if}>July</option>
                                    <option value="8" {if $search.month eq 8}selected="selected"{/if}>August</option>
                                    <option value="9" {if $search.month eq 9}selected="selected"{/if}>September</option>
                                    <option value="10" {if $search.month eq 10}selected="selected"{/if}>October</option>
                                    <option value="11" {if $search.month eq 11}selected="selected"{/if}>November</option>
                                    <option value="12" {if $search.month eq 12}selected="selected"{/if}>December</option>
                            </select>
                        </span>
                        <span class="form-group ts">
                            <select id="dobyear" name="year" class="form-control">
                                <option value="">Year</option>
                                {assign var=initYear value='Y'|date}
                                {for $year=$initYear-7 to $initYear-2}
                                    <option value="{$year}" {if $search.year eq $year}selected="selected"{/if}>{$year}</option>
                                {/for}
                            </select>
                        </span>
                        </div>
                        </div> -->
                        <div class="col-sm-12">
                            <label for="enrolsuburb"></label>
                            <div class="form-group nomargin" id="location">
                                <!--                                 <input type="text" class="form-control" id="enrolsuburb" name="location" value="{$search.location}" required/> -->
                                <span class="form-group ts">
		                            <select name="state" id="state" class="form-control">
		                            {foreach from=$states item=state}
		                            <option value="{$state.id}" {if $search.state eq $state.value}selected="selected"{/if}>{$state.value}</option>
		                            {/foreach}
		                            </select>
		                        </span>
		                        <span class="form-group ts">
		                            <select name="suburb" id="suburb" class="form-control">
		                            {foreach from=$suburbs item=suburb}
		                            <option value="{$suburb.id}" {if $search.suburb eq $suburb.value}selected="selected"{/if}>{$suburb.value}</option>
		                            {/foreach}
		                            </select>
		                        </span>
		                        <span class="form-group to">
		                            <select name="country" id="country" class="form-control">
		                            {foreach from=$countries item=country}
		                            <option value="{$country.id}" {if $search.country eq $country.value}selected="selected"{/if}>{$country.value}</option>
		                            {/foreach}
		                            </select>
		                        </span>
                            </div>
                        </div>
                        <div class="col-sm-12">
                            <button class="search" type="submit"><span>{$lang.home.search_btn}</span></button>
                            <div class="text-center">全国共有 {$cnt_locations} 家场馆，<a href="/our-program/locations">点击前往</a></div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{include file='helpblock.tpl'}
{/block}
{* Place additional javascript here so that it runs after General JS includes *}
{block name=tail}
<script type="text/javascript">
jQuery(document).ready(function($) {
	$('select').selectBoxIt();
	var oProvince = $("select#state");
    var oCity = $("select#suburb");
    var oCountry = $("select#country");

    var city = function(){
        var n = oProvince.get(0).selectedIndex;
        var id = oProvince.find("option:selected").val();
        $.ajax({
            url: "/process/regionsuburbs",
            dataType: "json",
            data: {
                query: id
            },
            success: function( data ) {
                console.log(data);
                oCity.data("selectBox-selectBoxIt").remove();
                oCity.data("selectBox-selectBoxIt").add(data);
                district();
            }
        });
    }

    var district = function(){
        var n = oCity.get(0).selectedIndex;
        var id = oCity.find("option:selected").val();
        $.ajax({
            url: "/process/regionsuburbs",
            dataType: "json",
            data: {
                query: id
            },
            success: function( data ) {
                console.log(data);
                oCountry.data("selectBox-selectBoxIt").remove();
                oCountry.data("selectBox-selectBoxIt").add(data);
            }
        });
    }

    city();
    
    oProvince.change(function(){
        city();
    });

    oCity.change(function(){
        district();
    });
    $('#search-classes-form').validate();
    $("#enrolsuburb").autocomplete({
        source: function(request, response) {
            $.ajax({
                url: "/process/postcodesuburbs",
                dataType: "json",
                data: {
                    query: request.term
                },
                success: function(data) {
                    response(data.values);
                }
            });
        },
        messages: {
            noResults: '',
            results: function() {}
        },
        minLength: 3
    });

    $('#tabs1 a').click(function(e) {
        e.preventDefault();
        $(this).tab('show');
    });
    $('#tabs2 a').click(function(e) {
        e.preventDefault();
        $(this).tab('show');
    });
});
</script>
{/block}
